package com.by.component.website.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

@Getter
@AllArgsConstructor
public enum WebsitePageTypeEnum {

    MP_WEBSITE(1, "公众号"),
    ADMIN_WEBSITE(2, "管理后台"),
    MA_WEBSITE(3, "小程序"),
    ;

    private Integer code;
    private String desc;

    private static final Map<Integer, WebsitePageTypeEnum> MAP = Arrays.stream(WebsitePageTypeEnum.values())
            .collect(Collectors.toMap(WebsitePageTypeEnum::getCode, Function.identity()));

    public static WebsitePageTypeEnum resolve(Integer code) {
        return MAP.get(code);
    }


}
